package cn.t.xsmart.modulestudy;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.launcher.ARouter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


public class MainActivity extends AppCompatActivity {


    @BindView(R.id.mTvIntoWeChat)
    TextView mTvIntoWeChat;
    @BindView(R.id.mTvIntoHome)
    TextView mTvIntoHome;
    @BindView(R.id.mTvIntoRecommend)
    TextView mTvIntoRecommend;
    @BindView(R.id.mTvIntoMe)
    TextView mTvIntoMe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.mTvIntoWeChat, R.id.mTvIntoHome, R.id.mTvIntoRecommend, R.id.mTvIntoMe})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.mTvIntoWeChat:
                ARouter.getInstance().build("/chat/activity/WechatActivity")
                        .navigation();
                break;
            case R.id.mTvIntoHome:
                ARouter.getInstance().build("/home/activity/HomeActivity")
                        .withString("Data", "携带的数据")
                        .navigation();
                break;
            case R.id.mTvIntoRecommend:
                ARouter.getInstance().build("/recommend/activity/RecommendActivity")
                        .withObject("DataObject", new User("贺景洲", "24"))
                        .navigation();
                break;
            case R.id.mTvIntoMe:
                ARouter.getInstance().build("/me/activity/MeActivity")
                        .navigation();
                break;
            default:
                break;
        }
    }

    class User {
        private String userName;
        private String age;

        public User(String userName, String age) {
            this.userName = userName;
            this.age = age;
        }

        @Override
        public String toString() {
            return "User{" +
                    "userName='" + userName + '\'' +
                    ", age='" + age + '\'' +
                    '}';
        }
    }
}
